|
![](/i/fill.gif) |
I am not completely sure about what I am talking here but at least
what I propose in the following lines removed black spots on the isosurface
of my Mars renderings. (These spots only occur when the light comes under
a flat angle and when no_shadow is NOT set.)
In isosurf.cpp, the recursive part of the root finder reads:
---------------------------------------
static int IsoSurface_Function_Find_Root_R(ISOSURFACE* ISOSRF, ISO_Pair*
EP1,
ISO_Pair* EP2, DBL dt, DBL t21, DBL len, bool in_shadow_test)
{
DBL temp;
temp = fabs((EP2->f - EP1->f) * len);
if(ISOSRF->gradient < temp) // update "max gradient found"
ISOSRF->gradient = temp;
if((ISOSRF->eval == true) && [...]
[...]
if(t21 < ISOSRF->accuracy)
{
#if ORIGINAL
if(EP2->f < 0)
{
ISOSRF->tl = EP2->t;
return true;
}
else return false;
#else /* !ORIGINAL /
if(EP2->f <= 0 && EP1->f >= 0.0)
{
ISOSRF->tl = 0.5*(EP2->t+EP1->t);
return true;
}
else if(EP2->f < 0) // This will normally not be reached (ww).
{
ISOSRF->tl = EP2->t;
return true;
}
else return false;
#endif
}
[...]
---------------------------------------
The idea is that in case we cross the isosurface threshold and
one point is outside (EP1) while the other one is inside (EP2),
then the average of the two depth values should give a better
estimate for the actual intersection than merely using EP2.
(This works because the root solver continuously halfes the interval
the root is in.)
The "else if" stmt is the original code which is probably not reached
normally because in case both points are inside the isosurface, we
should not be here.
At least that is what I think from reading the code because unfortunately
it completely lacks descriptive comments.
Maybe somebody with a clue could comment on that.
Wolfgang
Post a reply to this message
|
![](/i/fill.gif) |